package org.mq.mymq.nameserver.enums;

/**
 * @ClassName ReplicationModeEnum
 * @Description
 * @Author jiarong_ye
 * @Date 2025/6/19 23:54
 * @Version 1.0
 */
public enum ReplicationRoleEnum {
    MASTER("master", "主从模式-主节点"),
    SLAVE("slave", "主从模式-从节点"),
    NODE("not_tail_node", "链路复制模式-非尾部节点"),
    TAIL_NODE("tail_node", "链路复制模式-尾部节点")
    ;
    String code;
    String desc;

    ReplicationRoleEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static ReplicationRoleEnum of(String code) {
        for (ReplicationRoleEnum mode : ReplicationRoleEnum.values()) {
            if (mode.getCode().equals(code))
                return mode;
        }
        return null;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }
}
